<template>
  <div>
    

<div class="article toolbar">
	
    <div class="container">
    	
    	<div class="title ue-clear">
    	<h2>用户表管理</h2>
       
    </div>
    	
    	

<div class="table-box">
	<table class="table table-striped">
    	<thead>
    <tr>
    <th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th>
    <th>操作</th>
    </tr>
    </thead>
    
    <tbody>   
    <tr v-for="(item,index) in dataList" :key="index"><td>{{item.id}}</td><td>{{item.username}}</td><td>{{item.password}}</td><td>{{item.sex}}</td><td>{{item.birthday}}</td><td>{{item.address}}</td><td>{{item.email}}</td><td>{{item.qq}}</td><td>{{item.tel}}</td><td>{{item.money}}</td><td>{{item.thumb}}</td><td>{{item.grade}}</td><td>{{item.type}}</td><td>{{item.created}}</td><td>{{item.updated}}</td><td>{{item.status}}</td><td>{{item.age}}</td><td>{{item.ecard}}</td><td><a class="btn btn-primary" href="javascript:;" @click="editData(item.id)">修改</a><a class="btn btn-danger" href="javascript:;" @click="deleteData(item.id)">删除</a></td></tr>  
    
    
    </tbody>
    </table>
</div>
    	
</div>

</div>
	


  </div>
</template>
<script>
import { getList,deleteData } from '@/api/usersApi'

export default {
  name:'UsersList',
  data() {
    return {dataList:[]}
  },
  created() {
    this.$nextTick(() => {
      this.getList()
    })
  },
  methods: {
    editData(id){
      this.$router.push('/dashboard/users-edit/'+id);
    },
    deleteData(id){
    this.$confirm('你确定要删除吗？', '确认信息', {
          distinguishCancelAndClose: true,
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        })
          .then(() => {
           deleteData({id:id}).then(resp=>{
            this.$message.success({
              message:'删除成功',type:'success'
            })
            this.getList()
           })
          })
          .catch(action => {
          });
    },
    getList(){
       getList({}).then((resp) => {
        this.dataList = resp.data.data
      })
    }
  },
  beforeDestroy(){
this.removeFile('http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css','css');
this.removeFile( 'http://libs.baidu.com/jquery/2.0.0/jquery.min.js','js');
this.removeFile( 'source/scripts/window.js','js');
this.removeFile( 'http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js','js');

  },
  mounted(){
this.loadFile('http://libs.baidu.com/bootstrap1/3.0.3/css/bootstrap1.min.css','css');
this.loadFile( 'http://libs.baidu.com/jquery/2.0.0/jquery.min.js','js');
this.loadFile( 'source/scripts/window.js','js');
this.loadFile( 'http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js','js');

  }
}

</script>
<style scoped>

</style>
